package com.csxh.web.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 查询条件bean
 * 
 * @author Administrator
 *
 */
public class QueryCondition {

	private String fieldName;// 查询的字段名称
	private String fieldText;// 查询的字段显示名称
	private List<String> expressionList = new ArrayList<String>();// 条件表达式列表：>,<
	private String fieldValue = "*";// 查询的默认值

	
	public String getFieldText() {
		return fieldText;
	}

	public void setFieldText(String fieldText) {
		this.fieldText = fieldText;
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public List<String> getExpressionList() {
		return expressionList;
	}

	public void setExpression(Class<?> clazz) {

		if (clazz == String.class) {
			// 字段为字符类型，其表达式有：like not like
			this.expressionList.add("like");
			this.expressionList.add("not like");
		} else if (clazz == Long.class || clazz == Double.class) {
			// 字段为整数类型，其表达式有：=,>,<,>=,<=,,
			this.expressionList.add("=");
			this.expressionList.add("&gt;");
			this.expressionList.add("&lt;");
			this.expressionList.add("&gt;=");
			this.expressionList.add("&lt;=");
			this.expressionList.add("&lt;&gt;");
			this.expressionList.add("in");
			this.expressionList.add("not in");
			this.expressionList.add("between and");
			this.expressionList.add("not between and");
		} else if (clazz == java.util.Date.class) {
			this.expressionList.add("=");
			this.expressionList.add("&gt;");
			this.expressionList.add("&lt;");
			this.expressionList.add("&gt;=");
			this.expressionList.add("&lt;=");
			this.expressionList.add("&lt;&gt;");
			this.expressionList.add("between and");
			this.expressionList.add("not between and");
		} else if (clazz == Boolean.class) {
			this.expressionList.add("=");
			this.expressionList.add("&lt;&gt;");
			
		}

	}

	public String getFieldValue() {
		return fieldValue;
	}

	public void setFieldValue(String fieldValue) {
		this.fieldValue = fieldValue;
	}

}
